package com.tentact.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tentact.mapper.EmployeeMapper;
import com.tentact.mapper.MeetingMapper;
import com.tentact.mapper.MeetingparticipantsMapper;
import com.tentact.mapper.PageUtil;
import com.tentact.vo.Meeting;

import tk.mybatis.mapper.common.Mapper;
@Service
public class MeetingServiceImple implements MeetingService {
    @Autowired
	private MeetingMapper meetMapper;
    @Autowired
    private MeetingparticipantsMapper meetPartMapper;
    
	@Override
	public int insert(Meeting meeting) {
		// TODO Auto-generated method stub
		return meetMapper.insert(meeting);
	}

	@Override
	public int update(Meeting meeting) {
		// TODO Auto-generated method stub
		return meetMapper.updateByPrimaryKey(meeting);
	}

	@Override
	public int delete(Meeting meeting) {
		// TODO Auto-generated method stub
		return meetMapper.delete(meeting);
	}

	@Override
	@Transactional
	public int insertSelective(Meeting meeting,Integer[] employeeids) {
		// TODO Auto-generated method stub
		int result = meetMapper.insertSelective(meeting);
		meetPartMapper.batchInsert(meeting.getMeetingid(), employeeids);
		return result;
	}

	@Override
	public int updateSelective(Meeting meeting) {
		// TODO Auto-generated method stub
		return meetMapper.updateByPrimaryKeySelective(meeting);
	}

	@Override
	public Meeting selectByPrimaryKey(Integer meetingid) {
		// TODO Auto-generated method stub
		return meetMapper.selectByPrimaryKey(meetingid);
	}

	@Override
	public int selectMeetingCountPage(Meeting meeting, Date reservationtime, Date begintime) {
		// TODO Auto-generated method stub
		return meetMapper.selectMeetingCountPage(meeting, reservationtime, begintime);
	}

	@Override
	public List<Meeting> selectMeetingPage(Meeting meeting, Date reservationtime, Date begintime, PageUtil page) {
		// TODO Auto-generated method stub
		return meetMapper.selectMeetingPage(meeting, reservationtime, begintime, page);
	}

	@Override
	public Meeting selectByMeetingId(Integer meetingid) {
		// TODO Auto-generated method stub
		return meetMapper.selectByMeetingId(meetingid);
	}

	@Override
	public List<Meeting> selectByReservationistId(Integer reservationistId) {
		// TODO Auto-generated method stub
		return meetMapper.selectByReservationistId(reservationistId);
	}

	

}
